package com.tom.architect.party3.day29.rxjava;

import android.os.Bundle;
import android.util.Log;
import android.widget.ImageView;

import com.tom.architect.R;

import androidx.appcompat.app.AppCompatActivity;

// 观察者
public class MainActivity293 extends AppCompatActivity {
    private static final String TAG = "MainActivity292";
    // 给网络上的一张图片加水印，显示到 ImageView 控件上
    private ImageView mImageView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main29);
        mImageView = (ImageView) findViewById(R.id.image);

        // 一对一的观察者。
        Observable.just("url")
                .subscribe(new Observer<String>() {
                    @Override
                    public void onSubscribe() {
                        Log.e(TAG, "onSubscribe: =");
                    }

                    @Override
                    public void onNext(String s) {
                        Log.e(TAG, "onNext: =" + s);
                        Integer.parseInt("xx");
                    }

                    @Override
                    public void onError(Throwable e) {
                        Log.e(TAG, "onError: =");
                    }

                    @Override
                    public void onComplete() {
                        Log.e(TAG, "onComplete: =");
                    }
                });
    }

}
